<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
This tests for a bug where selecting a word would select the line break and word
before it.  Only the word in the paragraph below should be selected:
<div id="sample" contenteditable></div>
<div id="log"></div>
<script>
test(function() {
    var selection = window.getSelection();
    var sample = document.getElementById('sample');
    selection.collapse(sample, 0);
    document.execCommand('insertParagraph');
    document.execCommand('insertText', false, 'foo');
    selection.modify('extend', 'backward', 'word');

    assert_false(selection.isCollapsed, 'isCollapsed');
    assert_equals(selection.anchorNode, sample.lastChild.firstChild, 'anchorNode');
    assert_equals(selection.anchorOffset, 3, 'anchorOffset');
    assert_equals(selection.focusNode, sample.lastChild.firstChild, 'focusNode');
    assert_equals(selection.focusOffset, 0, 'focusOffset');
});
</script>
